package objects 
{
	/**
	 * ...
	 * @author Tuan
	 */
	import objects.MyObject;
	public class BulletManager 
	{
		protected var m_listBullet : Array;
		
		public function BulletManager() 
		{
			m_listBullet = new Array();
		}
		public function getBullet ( index : int) : Bullet {
			
			return m_listBullet[index];
		}
		public function update ( dt : Number):void
		{
			for ( var i : int = 0; i < m_listBullet.length; i++)
			{
				m_listBullet[i].update(1/60);
			}
		}
		public function Collision ( _enemy : MyObject, dt : Number) : void
		{
			for ( var i : int = 0; i < m_listBullet.length; i++)
			{
				m_listBullet[i].Collision (_enemy, dt);
				if ( m_listBullet[i].m_collision == true)
				{
					m_listBullet[i].release();
					m_listBullet.splice (i, 1);
				}
			}
			
		}
		public function addBullet (bullet : Bullet) :void
		{
			m_listBullet.push (bullet);
		}
		public function getListBullet () : Array
		{
			return m_listBullet;
		}
	}

}